@extends( 'layout.home' )
@section( 'content' )

    <div class="result_wrap">
        <form>
            <table class="add_tab">
                <tbody>
                <tr>
                    <th>车牌号：</th>
                    <td>
                       {{$data['carcity']}}  {{$data['plate_num']}}
                    </td>
                </tr>
                <tr>
                    <th>车类型：</th>
                    <td>
                        @if($data['plate_type']==1)小车
                            @else 货车/客车
                        @endif
                    </td>
                </tr>
                <tr>
                    <th><i class="require">*</i>车主姓名：</th>
                    <td>
                        {{$data['carname']}}
                    </td>
                </tr>
                <tr>
                    <th><i class="require">*</i>手机号：</th>
                    <td>
                        {{$data['carphone']}}
                    </td>
                </tr>
                <tr>
                    <th><i class="require">*</i>续租时长：</th>
                    <td>
                        <select id="duration">
                            <option value="0">请选择</option>
                            @for($i = 1; $i <= 36; $i++)
                                <option value="{{$i}}">{{$i}}个月</option>
                            @endfor
                        </select>
                        （单月租费：{{config('charge.MONTHLY')}}元/月/辆）
                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <input type="button" value="办理" id="submit">
                        <input type="button" class="back" onclick="history.go(-1)" value="返回">
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
<script src="https://cdn.bootcss.com/layer/3.1.0/layer.js"></script>
<script>
    $("#submit").click(function(){//点击提交
        var duration = $("#duration").val();
        if(duration==0){
            layer.msg('请选择！');
            return false;
        }
        $.post("{{url('handlerenewal')}}",{
            '_token':"{{csrf_token()}}",
            'id':"{{$data['id']}}",
            'duration':duration
        },function(data){
            if(data.code){
                layer.msg(data.msg);
                setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
                    var index=parent.layer.getFrameIndex(window.name);
                    window.parent.location.reload();
                    parent.layer.close(index);
                },2000);
            }else{
                layer.msg(data.msg);
            }
        });
    });
</script>
@endsection
